package yf.mall.enums;

import lombok.Getter;
import java.util.Arrays;


/**
 *
 *
 *
 * @date Wed Aug 02 10:54:31 CST 2023
 */
@Getter
public enum ArticleStatusEnum {


                   PUBLISH(0,"发表")
                                    ,
                
            
                   NEW(1,"未发表")
                
                                ;
            
        
        int index;
        String value;

    public static String[] names(){
        return Arrays.stream(ArticleStatusEnum.values()).map(m->m.getValue()).toArray(String[]::new);
    }

    ArticleStatusEnum(int index,String value) {
        this.index = index;
        this.value = value;
        }

    public static int nameOf(String name){
        Integer res = null;
        for (int i = 0; i < names().length; i++) {
            if(names()[i].equals(name)){
                res = i;
                break;
            }
        }
        return res;
    }

    public static String indexOf(int idx) {
        return ArticleStatusEnum.values()[idx].getValue();
    }

}
